import hmac,hashlib

def pw(pw,key):
	if(pw and key):
		md5one = hmac.new(key, pw, hashlib.md5).hexdigest()
		md5two = hmac.new('snow', md5one, hashlib.md5).hexdigest()
		md5three = hmac.new('kise', md5one, hashlib.md5).hexdigest()
		rule = [x for x in md5three]
		source = [x for x in md5two]
		for i in xrange(len(source)):
			if(not source[i].isdigit()) :
				string ="sunlovesnow1990090127xykab";
				if(string.find(rule[i]) > -1) :
					source[i] = source[i].upper();
		code32 = "".join(source);
		code1 = code32[:1];
		if(not code1.isdigit()) :
			code16 = code32[:16];
		else :
			code16 = "K" + str(code32[1:16]);
		return code16;
	return;

	pass


print pw('test','test')